UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jv8+yWIBUtB1a2cv1gzYHN9ZTiSVdpGb3j0UBaNh+Rw='
WHERE
key_id = 'a2793ae1ae998ab2b88188a7857ce10a536f8d19905670370f5a54f8a0916b94'
AND (
token = 'jv8+yWIBUtB1a2cv1gzYHN9ZTiSVdpGb3j0UBaNh+Rw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)