UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CbPgB/44BrgbgWgP7bZtREQmRYNf5zxLlLVsHZGqHR4='
WHERE
key_id = 'ffd54a93f31dac07513a41972c9992a9b82a6203ef20e3cb165a615009a548ca'
AND (
token = 'CbPgB/44BrgbgWgP7bZtREQmRYNf5zxLlLVsHZGqHR4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)