UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'V8ed3aURFyWqg1fUORfpCcVUEbcCKvk5UwMxZIfFYYg='
WHERE
key_id = '7bfbfab9c76e14e2cc75e89107d7422646dd8db4a455fa7bc7a5e4b2bf41d04c'
AND (
token = 'V8ed3aURFyWqg1fUORfpCcVUEbcCKvk5UwMxZIfFYYg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)