UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZFOczIokJAqEWpk5Q8h02NYBnuqJz0i1mzoe7FwwIUY='
WHERE
key_id = '7538b99f0b4ff08936ff6073f0d08897f02c7d9a802f2390c9233c0a5d0d0597'
AND (
token = 'ZFOczIokJAqEWpk5Q8h02NYBnuqJz0i1mzoe7FwwIUY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)