UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S1GnEjxR31Ho8kii+Uyt4JfcwathMflqzAtNnMlDoyI='
WHERE
key_id = '2e6d8dc0e3770854479688c5ebed821a809aa8fecf5e169225a0bb8ef6625005'
AND (
token = 'S1GnEjxR31Ho8kii+Uyt4JfcwathMflqzAtNnMlDoyI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)