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