UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D5cEM0y4d4qcfKPFBy1PAp9HfgGSffv1FgrvA51dYPs='
WHERE
key_id = '0bb7a9de16b602094d6c672d8bb4ce8bdd2937fadeb8019da6b9fdefb04a209b'
AND (
token = 'D5cEM0y4d4qcfKPFBy1PAp9HfgGSffv1FgrvA51dYPs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)