UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NethW45mZWfRRoDjYw2AJic8uyoXs6UuJrnkbQ+RIIU=' 
WHERE 
  key_id = '739c6573308347f7852d4ae7c9203676e5ad6f1b69190ff2e8c812327cf066d9' 
  AND (
    token = 'NethW45mZWfRRoDjYw2AJic8uyoXs6UuJrnkbQ+RIIU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046