UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'vXGJQUz1NACstNkVCynqp0xyyQ9WjIxzDcORSEGuS6I='
WHERE
key_id = 'cc6ed33e83f5ad1f928798d63c55c1ba4e2bd6a6e05a7a53712270504c1887f1'
AND (
token = 'vXGJQUz1NACstNkVCynqp0xyyQ9WjIxzDcORSEGuS6I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)