UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X2Nj1cGDuRNG1Jxe5ZsCuRtP4ceiPkTUN0KFegxWDM0='
WHERE
key_id = 'f4916eabe152a7ac564f179d531d34a97c9568ce3e8d9aa60ca0e2dfb21bd3ec'
AND (
token = 'X2Nj1cGDuRNG1Jxe5ZsCuRtP4ceiPkTUN0KFegxWDM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)