UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HEumIhJac+3reTR57fg2LhujKmS6+2kLUBx7BOj1nTw=' 
WHERE 
  key_id = '471d600239541bb5e64474bb5577aa3055f6014e8f14b4c127097e8fb2dd2b61' 
  AND (
    token = 'HEumIhJac+3reTR57fg2LhujKmS6+2kLUBx7BOj1nTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038