UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tcpJaWyqCd3SEPNP5GJ5vJpBp+Usd+oAk9kth2oeWL0=' 
WHERE 
  key_id = 'b8900123e9bd875afe3dabd16c70ab710c9c0711060dc624b41b2d2efe525afa' 
  AND (
    token = 'tcpJaWyqCd3SEPNP5GJ5vJpBp+Usd+oAk9kth2oeWL0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022