UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9qnHyVmn0cOPKVmBrND+fknbpG2+VOu40HZH8UfCXYA='
WHERE
key_id = 'ae5974217ac15c7a795cf414683b328015a50a707708845b8b6c5968933f4834'
AND (
token = '9qnHyVmn0cOPKVmBrND+fknbpG2+VOu40HZH8UfCXYA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)