UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QfomPoFHzTpiQCXzfQLTIPBhus7XeLap6ACHRCpaGVg='
WHERE
key_id = 'a3a4f7e652edcb0e53a0459165f6c969f60f740f38287fb6e39dde4a05ba06dc'
AND (
token = 'QfomPoFHzTpiQCXzfQLTIPBhus7XeLap6ACHRCpaGVg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)