UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3Eiu60rTR8Fseb0r/yGbrA2sGMDSZAyddY8hbc+nMU4='
WHERE
key_id = 'f02172a5c2881a494ccf74b8745bb03aee807ad27244041d2b4cac68be2c5c28'
AND (
token = '3Eiu60rTR8Fseb0r/yGbrA2sGMDSZAyddY8hbc+nMU4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)