UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rC7RfGmqX+p26jSrbyaAbSyVXueoF8ohC+76Tz18ZI4=' 
WHERE 
  key_id = '338825320eac266e00b3750f9d007bfa944d0537f3211a39f405fec3d989db7a' 
  AND (
    token = 'rC7RfGmqX+p26jSrbyaAbSyVXueoF8ohC+76Tz18ZI4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029