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

Query time 0.00020