UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hhP2qM+S50AOwNTw4L9yIsrMrnr5gBUp8qLQ7W+q6f4=' 
WHERE 
  key_id = '2eb43d2224c48cdd19f3978c12dcad90fd84f18b51b99f7d84c3a43fb33e82e0' 
  AND (
    token = 'hhP2qM+S50AOwNTw4L9yIsrMrnr5gBUp8qLQ7W+q6f4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029