UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'm1bHj8pE27JKH+EtfAbE+Ov02P1QXY2HCBt1RTEIaL8='
WHERE
key_id = 'a24f0b06ca1850a63d4fc4ca1d3b5f337d0c9f250543b337144c592ab6716078'
AND (
token = 'm1bHj8pE27JKH+EtfAbE+Ov02P1QXY2HCBt1RTEIaL8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)