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