UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HJ+VWPR+qfFxBsE4euqV8wWJeJOyJC9oF1z8aGYprks=' 
WHERE 
  key_id = 'e51f8f27de10f30c6f645c954bdd42da19dd084b531347d6389ac3f7a7651375' 
  AND (
    token = 'HJ+VWPR+qfFxBsE4euqV8wWJeJOyJC9oF1z8aGYprks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034