UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zo+dKd8V6ddMZ1C+4YPjN0btWALGNU+RpyIrLOSYJ7Y='
WHERE
key_id = 'aa39e9762357a705b89f7374f024880fe31ad9da308d84f70ec8cc393788d1b2'
AND (
token = 'Zo+dKd8V6ddMZ1C+4YPjN0btWALGNU+RpyIrLOSYJ7Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)