UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S4cXK6BGxG9FGgbEp8Q4LWnjnTtOt3ZOKm7vbT8fgw4='
WHERE
key_id = '9dea477d8cbec20967ad69d09d61dbc529ecd853a5e6497659c3960b7cc711b2'
AND (
token = 'S4cXK6BGxG9FGgbEp8Q4LWnjnTtOt3ZOKm7vbT8fgw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)