UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oDatdd/MTpU88njCsDBeWS6JshlUsx1czIc1rnV1m84='
WHERE
key_id = '2265e3f21d45bf0ecae008ff207e03494b5784b02714a5718c85f0673edbd343'
AND (
token = 'oDatdd/MTpU88njCsDBeWS6JshlUsx1czIc1rnV1m84='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)