UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aGioFMaleKHWeOy1MmDHSF9xRGiBv+t8fRVOgZEuJAg='
WHERE
key_id = '11ad598246af6085e0ca22edc1efa9f6504635df668b0c3a29988a4f679a3209'
AND (
token = 'aGioFMaleKHWeOy1MmDHSF9xRGiBv+t8fRVOgZEuJAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)