UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NrAm3TcydbKgl+32Fs5BnrQlgZRuaWc/XjJC3tiwZGk='
WHERE
key_id = '731ba69351c20a6fe33d10316996df471cd48bb1699cde45e86ad39d1418f407'
AND (
token = 'NrAm3TcydbKgl+32Fs5BnrQlgZRuaWc/XjJC3tiwZGk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)