UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QOb2VclpmHKYafRm3h/7SSdyE8qxWqd0oXVNv7ANen4='
WHERE
key_id = 'f691460d3436b7b3e5a1954408fb8c047e748f0786cbc22adb6e6101c27141ff'
AND (
token = 'QOb2VclpmHKYafRm3h/7SSdyE8qxWqd0oXVNv7ANen4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)