UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TAhhj4d06iV7KwOwhwB72qwhM1YY9wNxRkk2Q79RRoI='
WHERE
key_id = '46431f9ee2b6679740b43aa6f991688b3a9d820dea7401decfa0615609721aa2'
AND (
token = 'TAhhj4d06iV7KwOwhwB72qwhM1YY9wNxRkk2Q79RRoI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)