UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WjgcvmX9skL9Hk2WlvXlZDurk0jtphjnae44XRHmG3M=' 
WHERE 
  key_id = '4d1c82c72a48458c913490f97635ebb91e64cda0a15d398c1b16f714580364a6' 
  AND (
    token = 'WjgcvmX9skL9Hk2WlvXlZDurk0jtphjnae44XRHmG3M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034