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