UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JjAT9A4e8sFSZK6YlnHmotc2OszF7knY2FevuzpF7OU=' 
WHERE 
  key_id = '8ead406de68bb4a73da231d8f6cbd8f8517c7da584bacbb0169bb0af9450813b' 
  AND (
    token = 'JjAT9A4e8sFSZK6YlnHmotc2OszF7knY2FevuzpF7OU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055