UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BjriAQhRPWaSQnFsyuYBpOXLKxTiCzMgorluxQFMu6Q=' 
WHERE 
  key_id = '25bd91df84113277f7aa1b5290228f38717f6e17e79aa1d8256d197a0b551803' 
  AND (
    token = 'BjriAQhRPWaSQnFsyuYBpOXLKxTiCzMgorluxQFMu6Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020