UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8WDzW8V9izdrJFgJDTRGm+ksG5cvcPKimR+3REcBELo=' 
WHERE 
  key_id = '4574cb68d00a696f6e256e7da85a81df37de5450c179dde87046b5925e3acdf2' 
  AND (
    token = '8WDzW8V9izdrJFgJDTRGm+ksG5cvcPKimR+3REcBELo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025