UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ht3P4zgslopH7ZkUm/5QeD3lEyidqqz9YTf9bG9iOYI='
WHERE
key_id = '7b664b31176434c920135c0595da38c37e3e3e923e1c5544b4bd24782dfeb4ac'
AND (
token = 'ht3P4zgslopH7ZkUm/5QeD3lEyidqqz9YTf9bG9iOYI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)