UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'miEqXLhAF+9K6CxRk1XJyv4dAB3zLsirLt4bQKzUpV4=' 
WHERE 
  key_id = '8d5ab1fd6e755eb625a8d9c8514df2e74c6129c3a95c3d59aef916fd271d8eca' 
  AND (
    token = 'miEqXLhAF+9K6CxRk1XJyv4dAB3zLsirLt4bQKzUpV4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038