UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3vtiRwvQ0mDjvtTcWcWiF33uqIcsH6k6buy3qo4FK54='
WHERE
key_id = '4ce809ad6566c2ba34e4e65dfcc4167ef642e8fdc0fcc8926e7ee683d1be3d1b'
AND (
token = '3vtiRwvQ0mDjvtTcWcWiF33uqIcsH6k6buy3qo4FK54='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)