UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gc3dLtd88VsLFFFWFW03YdmLV+cKLiUJU1BnY4eEHSw='
WHERE
key_id = '97943c98419f59a1749d3d828aa4ad7e86c19caf6c3e394230d7cb74a7cc57a1'
AND (
token = 'gc3dLtd88VsLFFFWFW03YdmLV+cKLiUJU1BnY4eEHSw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)