UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZKo6d1npUKpSEVvYzeTaZ+3Yz1Uo1j+MrY/02sqvTJ0=' 
WHERE 
  key_id = '0ddf26bd22ff46c86bce1fe481852011306548b48978bf6cf97bc8c23c856816' 
  AND (
    token = 'ZKo6d1npUKpSEVvYzeTaZ+3Yz1Uo1j+MrY/02sqvTJ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032