UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X1oeZlEmknvqHacNHPyRnCTbOvp4vEREtUM6nAPfe0g='
WHERE
key_id = '42d44e3322d3c2e0878fd222904ad0ce193ef90893145aaeefe36c5a754bf0dd'
AND (
token = 'X1oeZlEmknvqHacNHPyRnCTbOvp4vEREtUM6nAPfe0g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)