UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xHI3zN6dmUC4w4l+k2f/dTsNBiV+facBPKEKpZN7vZ8='
WHERE
key_id = 'e4ac76418b6661825a96ce465ebd34879e02e1df64c102547fb50a7c88db9d1d'
AND (
token = 'xHI3zN6dmUC4w4l+k2f/dTsNBiV+facBPKEKpZN7vZ8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)