UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aXyOjaQDouA7DLWJ+rPofb5z/kp/GaCkl+vgdJzbySc='
WHERE
key_id = 'aeaabf6818b046089f5571722a2d6c6708aeeb714a4208715c455dab66df1dcd'
AND (
token = 'aXyOjaQDouA7DLWJ+rPofb5z/kp/GaCkl+vgdJzbySc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)