UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ffsb6xbKAufKhhxh08XZWHExDFz/gg5Rv6D/xstDMqU='
WHERE
key_id = 'b3e373847c2187917d7628245c8b3b5e563203507f8ede623b60bec32d94ac69'
AND (
token = 'ffsb6xbKAufKhhxh08XZWHExDFz/gg5Rv6D/xstDMqU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)