UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '16WNCtAJiSMm0QatdWIxI3EVApsNMm+eZ7SjdiwDJiw='
WHERE
key_id = 'c4bbe5c8b7c55d6087244247ff3ec783ac72bb406518c37f20f4d134590aae1a'
AND (
token = '16WNCtAJiSMm0QatdWIxI3EVApsNMm+eZ7SjdiwDJiw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)