UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IRCdDpU3qLrUBrS5c9JcwMHX6Wb2rmHFYElOdB+29ZY=' 
WHERE 
  key_id = 'd29660fdcb356e6941899bb5a881906be03183656b986638f3648ff356480a05' 
  AND (
    token = 'IRCdDpU3qLrUBrS5c9JcwMHX6Wb2rmHFYElOdB+29ZY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035