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