UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r/eRMfyGJ04h1UwmIYOWFXR5Qleuc2b52EJ6GP325h0='
WHERE
key_id = 'db2d847ff4ce3b10837cc19bd39c44ca9b8bd89485395ecc49a55badc15504fe'
AND (
token = 'r/eRMfyGJ04h1UwmIYOWFXR5Qleuc2b52EJ6GP325h0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)