UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YEjMhAJm40NEZACnA24uGgW33ksXY6YoNRFZEmXhQTw=' 
WHERE 
  key_id = '7459b8710b81af017b6a5467385b44f52a491c00dce60e267a79ff5ef106059b' 
  AND (
    token = 'YEjMhAJm40NEZACnA24uGgW33ksXY6YoNRFZEmXhQTw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065