UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xXVyo5jXe6+PXBDmwE543S6wTSmcpbGmCbZHYEgq5n8='
WHERE
key_id = 'ccf145199d8e89887c50b6a7d0a6ffdfd79cb12e9ce4dc94eec13f5095352cad'
AND (
token = 'xXVyo5jXe6+PXBDmwE543S6wTSmcpbGmCbZHYEgq5n8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)