UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Gb28KeyLkABr6H2ZXSC7gNcas6WqbRUkgyKgPN0fFnk='
WHERE
key_id = '40b00f47a45e6a1bd8eaac41e184280e9daf552a863b82b3867ca4cbb5048595'
AND (
token = 'Gb28KeyLkABr6H2ZXSC7gNcas6WqbRUkgyKgPN0fFnk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)