UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HFCFFTaPWVrmdKEX60btqjRTLDPcVl9MNDHbO1NJcd8=' 
WHERE 
  key_id = '917d9811c67f867b541dc99e14975ae39abbb865aa23110eacea027695fdd9a7' 
  AND (
    token = 'HFCFFTaPWVrmdKEX60btqjRTLDPcVl9MNDHbO1NJcd8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040