UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6B+tB7K4vu0HLMCRndgcX02oVGGaR+9wT345WEE75m4='
WHERE
key_id = '3fd78263721d239179aa50678734eef44485c74ae55bdb181f237da6eaafa8c0'
AND (
token = '6B+tB7K4vu0HLMCRndgcX02oVGGaR+9wT345WEE75m4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)