UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j7Rv1jrl8omMbUFGx7Az9QnT7MD771sTCigTOUK5HpA='
WHERE
key_id = '8d04616d34f4c3c1d257081290678ca5945ec8daeecc12b573ca2752ef9388ff'
AND (
token = 'j7Rv1jrl8omMbUFGx7Az9QnT7MD771sTCigTOUK5HpA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)