UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h1KRxrXnebfdCynLwvXs3asr7kLMkggejdaGX45ODKQ=' 
WHERE 
  key_id = 'f5f6859a8872d8a975b7a900b9c4d8ce8c5034aa9a43093d6d73d9e0da7badea' 
  AND (
    token = 'h1KRxrXnebfdCynLwvXs3asr7kLMkggejdaGX45ODKQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031