UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TrLIYlOrhPTGFKj815M7hi6XrrR3Cm6gpV5H60xMSco='
WHERE
key_id = '647d480f65138632352bb126fad1c0e8de3dc49309aba47f5dda63764b8c2f65'
AND (
token = 'TrLIYlOrhPTGFKj815M7hi6XrrR3Cm6gpV5H60xMSco='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)