UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WMZ03X5bsYzgHFMcuNe01BApu9BUA+8gLROJ2T4h47c='
WHERE
key_id = 'c77fa515853e88867df0e5083e09c9923b0b7a327ce869e2921a92873784ec67'
AND (
token = 'WMZ03X5bsYzgHFMcuNe01BApu9BUA+8gLROJ2T4h47c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)