UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A6p0riWf8okYvZl42HST15LIX8PBEdwH9jsaBoXRel8='
WHERE
key_id = '70a6301420bc7f8ca80c066393d834c791feb36999dc2d0e60019ace6e47947c'
AND (
token = 'A6p0riWf8okYvZl42HST15LIX8PBEdwH9jsaBoXRel8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)