UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r1yw9XgzqiQWV4wTapYfUI7t6o9ZHP4ZgAC4eEPtE20='
WHERE
key_id = '1017ebfdc68a95d685108a53fb8ec59758384fcef43d5dad561043f5f4bf6d45'
AND (
token = 'r1yw9XgzqiQWV4wTapYfUI7t6o9ZHP4ZgAC4eEPtE20='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)